Expand description
Nacos in Rust
Thorough examples have been provided in our repository.
Add Dependency
Add the dependency in Cargo.toml
:
- If you need async API, which can be enabled via
features = ["async"]
[dependencies]
nacos-sdk = { version = "0.2", features = ["default"] }
General Configurations and Initialization
Nacos needs to be initialized. Please see the api
module.
Example of Config
ⓘ
let config_service = nacos_sdk::api::config::ConfigServiceBuilder::new(
nacos_sdk::api::props::ClientProps::new()
.server_addr("0.0.0.0:8848")
// Attention! "public" is "", it is recommended to customize the namespace with clear meaning.
.namespace("")
.app_name("todo-your-app-name"),
)
.build()?;
Example of Naming
ⓘ
let naming_service = nacos_sdk::api::naming::NamingServiceBuilder::new(
nacos_sdk::api::props::ClientProps::new()
.server_addr("0.0.0.0:8848")
// Attention! "public" is "", it is recommended to customize the namespace with clear meaning.
.namespace("")
.app_name("todo-your-app-name"),
)
.build()?;
Modules
- Nacos API